<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
	  var incrementVar = 0;
				jQuery('#addattr').click(function (){
							var newDate = new Date;
							var randomNum = newDate.getTime();
							var	apphtml1 = jQuery('.appendop').html().replace('data[OptionValue][13310274][name]','data[OptionValue]['+randomNum+'][name]');
							var apphtml2 = apphtml1.replace('data[OptionValue][13310274][option_id]','data[OptionValue]['+randomNum+'][option_id]');
							var apphtml3 = apphtml2.replace('data[OptionValue][13310274][id]','data[OptionValue]['+randomNum+'][id]');
							var apphtml4 = apphtml3.replace('data[OptionValue][13310274][status]','data[OptionValue]['+randomNum+'][status]');
							jQuery('.appendval').append("<div id='"+randomNum+"'></div>");
							jQuery('#'+randomNum).html(apphtml4);
					});

	});
</script>

<div id="mws-container" class="clearfix">
<div class="container">
  <div class="mws-panel grid_8">
    <div class="mws-panel-header"> <span class="mws-i-24 i-list" id="addattr" style="cursor:pointer;">Add More</span> </div>
    <div class="mws-panel-body">
      <div class="mws-form-inline"> 
	  <?php echo $form->create(array('controller'=>'setups','action'=>'','method'=>'post','class' => 'mws-form')); ?>
   
         <div class="appendop">
             <?php 
		if(isset($details['OptionValue']['id'])){$details['OptionValue']['id']=$details['OptionValue']['id'];}else{$details['OptionValue']['id']="";}
	     echo $this->Form->input('OptionValue.id', array('type' => 'hidden','name'=>'data[OptionValue][13310274][id]','value'=>$details['OptionValue']['id']));?>
           <div class="mws-form-row">
          <label>* Title :</label>
          <div class="mws-form-item small"> <?php 
		  if(isset($details['OptionValue']['name'])){$details['OptionValue']['name']=$details['OptionValue']['name'];}else{$details['OptionValue']['name']="";}
		  echo $this->Form->input('OptionValue.name', array('type' => 'text','name'=>'data[OptionValue][13310274][name]','value'=>$details['OptionValue']['name'],'class'=>'mws-textinput','label' =>false));?> </div>
        </div>
        <div class="mws-form-row">
          <label>Parent Option:</label>
          <div class="mws-form-item small">
            <?php 
		     	if(isset($details['OptionValue']['option_id'])){$details['OptionValue']['option_id']=$details['OptionValue']['option_id'];}else{$details['OptionValue']['option_id']="";}
					echo $this->Form->input('OptionValue.option_id', 
			array('type' => 'select','options'=>$list_options,
			'default'=>$details['OptionValue']['option_id'],'name'=>'data[OptionValue][13310274][option_id]', 'class'=>'mws-textinput','empty'=>false,'label' =>false)
			);
			?>
          </div>
        </div>

        <div class="mws-form-row">
          <label>Status Type :</label>
          <div class="mws-form-item 	small">
            <?php 
		     	if(isset($details['OptionValue']['status'])){$details['OptionValue']['status']=$details['OptionValue']['status'];}else{$details['OptionValue']['status']="";}
				$OptionValues = array('1'=>'Active', '0'=>'Deactive'); 
					echo $this->Form->input('OptionValue.status', 
					array('type' => 'select','options'=>$OptionValues,
					'default'=>$details['OptionValue']['status'],'name'=>'data[OptionValue][13310274][status]','class'=>'mws-textinput','empty'=>false,'label' =>false)
				);
			?>
          </div>
        </div>
        </div>
        <div class="appendval">
        </div>
        <div class="mws-button-row">
          <input type="submit" class="mws-button black" value="Submit">
        </div>
        </form>
      </div>
    </div>
  </div>
</div>
